<template>
  <div class="rTwo" v-show="leftStyle">
    <div style="height: 10px;"></div>
    <div class="roomTwo" id="rTwo">
      <div class="weui-loadmore weui-loadmore_line" v-show="tishi">
        <span class="weui-loadmore__tips">暂无数据</span>
      </div>
      <!-- v-for="(share, index) in shareData" :key="index" -->
      <div :class="{'shareTwo': true, 'niuniu10' : share.roomConf.maxPlayerCount > 6 }" v-for="(share, index) in shareData" :key="index + 164">
        <img src="../img/buttom-six.png" alt="" class="bottom-img-6" v-if="share.roomConf.maxPlayerCount != 10">
        <img src="../img/buttom-shi.png" v-else>
        <div class="weui-cell">
          <div class="weui-cell__hd">
            <!-- <img src="../img/majiang-icon-old.png" style="width: 43px;height:43px;">  -->
            <img v-if="share.gameType === 'HONGZHONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/majiang-icon.png`">
            <img v-else-if="share.gameType === 'DIANZINIU'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/dianzi-bull.png`">
            <img v-else-if="share.gameType === 'BULLFIGHT'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/bull-icon-old.png`">
            <img v-else-if="share.gameType === 'OXFIGHT'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/fight-bull.png`">
            <img v-else-if="share.gameType === 'SANGONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/sangong.png`">
            <img v-else-if="share.gameType === 'HUACHUAN'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/jinhua.png`">
            <img v-else-if="share.gameType === 'JINHUA'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/jinhua.png`">
            <img v-else-if="share.gameType === 'RUNFAST'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/run.png`">
            <img v-else-if="share.gameType === 'PJMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/zn.png`">
            <img v-else-if="share.gameType === 'CSMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/cs-majiang.png`">
            <img v-else-if="share.gameType === 'HUZMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/cs-majiang.png`">

          </div>
            <div class="weui-cell__bd">
              <!-- <span style="">红中麻将</span>   -->
              <span v-if="share.gameType === 'HONGZHONG'">红中麻将</span>
              <span v-else-if="share.gameType === 'DIANZINIU'">点子牛牛</span>
              <span v-else-if="share.gameType === 'BULLFIGHT'">经典牛牛</span>
              <span v-else-if="share.gameType === 'OXFIGHT'">斗公牛</span>
              <span v-else-if="share.gameType === 'SANGONG'">三公</span>
              <span v-else-if="share.gameType === 'HUACHUAN'">无庄开船</span>
              <span v-else-if="share.gameType === 'JINHUA'">欢乐金花</span>
              <span v-else-if="share.gameType === 'RUNFAST'">跑得快</span>
              <span v-else-if="share.gameType === 'PJMAHJONG'">平江扎鸟</span>
              <span v-else-if="share.gameType === 'CSMAHJONG'">长沙麻将</span>
              <span v-else-if="share.gameType === 'HUZMAHJONG'">惠州麻将</span>
              <span>房间号:{{share.roomNo}}</span>
              <!-- <p>{{share._createTime}}</p> -->
              <!-- <span style="">房间号:333333</span> -->
              <!-- <div class="time"> <p>2017-12-12 下午19:11</p></div> -->
              <div class="time">
                <p>{{share._createTime}}</p>
              </div>
            </div>
            <!-- <div class="weui-cell__ft">
                                    <img src="../img/share.png" style="width: 50px;height:30px;position:static;">
                                  </div>  -->
            <div class="weui-cell__ft" v-if="share.start === false ">
              <!-- <img src="../img/shareAn.png" style="width: 25px;height:30px;position:static;" media="screen and (max-width:360px)" > -->
              <!-- <img src="../img/share.png" style="width: 25px;height:30px;position:static;" media="screen and (max-width:360px)"> -->
              <img src="../img/xq.png" @click="xqButtom(share, index)">
              <img src="../img/share-new.png" @click="shareButtom(share)">
          </div>
              <div class="weui-cell__ft" @click="shareButtomAn()" v-else-if="share.start === true ">
                <img src="../img/share-newAn.png" style="width: 50px;height:30px;position:static;">
          </div>
              </div>
              <div class="share-two">
                <ul>
                  <!-- v-for="(play, index) in share.players" :key="index" -->
                  <li v-for="(play, index) in share.players" :key="index + 200">
                    <span>{{short(play.nickname)}}</span>
                    <!-- <span>傻傻傻</span> -->
                  </li>
                </ul>
              </div>
              <div class="share-three">
                <!-- <p>支付方式：AAA支付</p>  -->
                <p v-if="share.payType === 1 "> 支付方式：AA支付</p>
                <p v-else-if="share.payType === 2 "> 支付方式：房主支付</p>
                <p>俱乐部ID:{{share.searchId}}</p>
                <!-- <p>玩法ID:222222</p>    -->
              </div>
            </div>
            <div :class="{'shareTwo': true, 'niuniu10': record.maxPlayerCount > 6}" v-for="(record, index) in recordData" :key="index + 300">
              <img src="../img/buttom-six.png" alt="" class="bottom-img-6" v-if="record.maxPlayerCount != 10">
              <img src="../img/buttom-shi.png" v-else>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <img v-if="record.gameType === 'HONGZHONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/majiang-icon.png`">
                  <img v-else-if="record.gameType === 'DIANZINIU'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/dianzi-bull.png`">
                  <img v-else-if="record.gameType === 'BULLFIGHT'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/bull-icon-old.png`">
                  <img v-else-if="record.gameType === 'OXFIGHT'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/fight-bull.png`">
                  <img v-else-if="record.gameType === 'SANGONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/sangong.png`">
                  <img v-else-if="record.gameType === 'HUACHUAN'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/wansanzhang.png`">
                  <img v-else-if="record.gameType === 'JINHUA'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/wansanzhang.png`">
                  <img v-else-if="record.gameType === 'RUNFAST'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/run.png`">
                  <img v-else-if="record.gameType === 'CSMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/cs-majiang.png`">
                  <img v-else-if="record.gameType === 'PJMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/zn.png`">
                  <img v-else-if="record.gameType === 'HUZMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/huizhou-majiang.png`">
          </div>
                  <div class="weui-cell__bd">
                    <span v-if="record.gameType === 'HONGZHONG'">红中麻将</span>
                    <span v-else-if="record.gameType === 'DIANZINIU'">点子牛牛</span>
                    <span v-else-if="record.gameType === 'BULLFIGHT'">经典牛牛</span>
                    <span v-else-if="record.gameType === 'OXFIGHT'">斗公牛</span>
                    <span v-else-if="record.gameType === 'SANGONG'">三公</span>
                    <span v-else-if="record.gameType === 'HUACHUAN'">无庄开船</span>
                    <span v-else-if="record.gameType === 'JINHUA'">欢乐金花</span>
                    <span v-else-if="record.gameType === 'RUNFAST'">跑得快</span>
                    <span v-else-if="record.gameType === 'PJMAHJONG'">平江扎鸟</span>
                    <span v-else-if="record.gameType === 'CSMAHJONG'">长沙麻将</span>
                    <span v-else-if="record.gameType === 'HUZMAHJONG'">惠州麻将</span>
                    <span>房间号:{{record.roomNo}}</span>
                    <div class="time">
                      <p>{{record._createTime}}</p>
                    </div>
                  </div>
                  <a :href='record.url'>
            <div class="weui-cell__ft">
              <img src="../img/record.png" style="width: 50px;height:30px;position:static;">
            </div>
          </a>
                </div>
                <div class="share-two">
                  <ul>
                    <li v-for="(recordPe, index) in record.totalSettleVo" :key="index + 400">
                      <span>{{short(recordPe.nickName)}}</span>
                    </li>
                  </ul>
                </div>
                <div class="share-three">
                  <p v-if="record.gameType === 'HONGZHONG' && record._ruleType === 5">八个码/{{record.totalTurns}}局</p>
                  <p v-else-if="record.gameType === 'HONGZHONG' && record._ruleType === 1">一码全中/{{record.totalTurns}}局</p>
                  <p v-else-if="record.gameType === 'HONGZHONG' && record._ruleType === 2">两个码/{{record.totalTurns}}局</p>
                  <p v-else-if="record.gameType === 'HONGZHONG' && record._ruleType === 3">四个码/{{record.totalTurns}}局</p>
                  <p v-else-if="record.gameType === 'HONGZHONG' && record._ruleType === 4">六个码/{{record.totalTurns}}局</p>
                  <p v-else-if="record.gameType === 'OXFIGHT' && record._bottomType === 1">10分/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'OXFIGHT' && record._bottomType === 2">20分/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'OXFIGHT' && record._bottomType === 3">30分/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'OXFIGHT' && record._bottomType === 4">50分/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'BULLFIGHT' && record._ruleType === 1">抢庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'BULLFIGHT' && record._ruleType === 2">牛牛庄家/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'BULLFIGHT' && record._ruleType === 3">牌大坐庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'BULLFIGHT' && record._ruleType === 4">轮庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'BULLFIGHT' && record._ruleType === 5">霸王庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'DIANZINIU' && record._ruleType === 6">牛几几倍/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'DIANZINIU' && record._ruleType === 7">牛牛相差/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'HUACHUAN' && record._ruleType === 0">无庄开船/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'SANGONG' && record._ruleType === 0">无庄开船/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'SANGONG' && record._ruleType === 1">抢庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'SANGONG' && record._ruleType === 2">三公庄家/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'SANGONG' && record._ruleType === 3">牌大坐庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'SANGONG' && record._ruleType === 4">轮庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'SANGONG' && record._ruleType === 5">霸王庄/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'JINHUA' && record._ruleType === 1">十回合封顶/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'JINHUA' && record._ruleType === 2">二十回合封顶/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'JINHUA' && record._ruleType === 3">三十回合封顶/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'RUNFAST' && record._ruleType === 1"> 十五张/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'RUNFAST' && record._ruleType === 2"> 十六张/{{record.totalTurns}}局/{{record._showCardCount}}张可见</p>
                  <p v-else-if="record.gameType === 'PJMAHJONG' && record._ruleType === 1"> 一个鸟/{{record.totalTurns}}局</p>
                  <p v-else-if="record.gameType === 'PJMAHJONG' && record._ruleType === 2"> 两个鸟/{{record.totalTurns}}局</p>
                  <p v-else-if="record.gameType === 'PJMAHJONG' && record._ruleType === 3"> 三个鸟/{{record.totalTurns}}局</p>
                </div>
              </div>
            </div>
            <footer id="Two">
              <div class="weui-cells" style="margin-top:0;position:static;height:100%;background-color:transparent">
                <div class="weui-cell" style="height:100%;padding:0;padding-left:3%;">
                  <a :href='loginU'>
            <div class="weui-cell__hd"><img src="../img/back-btn.png" style="width:20px;height:20px;"></div>
          </a>
                  <!-- style="margin-left:28%;" -->
                  <div class="weui-cell__bd" style="text-align: center;margin-left:-10%;">
                    <span style="color:white;font-size:20px;">我的房间</span>
                  </div>
                </div>
              </div>
            </footer>
            <!-- <div style="border:solid 1px red;width:100%;height:100%;position: absolute;top: 0;bottom: 0;left: 0;right: 0;background-color:black;opacity:0.5;z-index:0;" v-show="blackZz"> -->
            <div class="zhezhao" v-show="zhezhaoSty" id="zhezhao">
              <img src="../img/zz-di.png" style="position: absolute;margin-top:10px">
              <img src="../img/gb.png" style="position: absolute;width:20px;height:20px;margin-left:95%;" @click="qudiao">
              <div class="weui-panel__bd" style="margin-top:16px;">
                <a class="weui-media-box weui-media-box_appmsg" style="padding:0;padding-top:3px;">
          <div class="weui-media-box__hd" style="margin-right:0;">
            <img class="weui-media-box__thumb" v-if="zedata.gameType === 'HONGZHONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/majiang-icon.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'DIANZINIU'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/dianzi-bull.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'BULLFIGHT'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/bull-icon-old.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'OXFIGHT'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/fight-bull.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'SANGONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/sangong.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'HUACHUAN'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/jinhua.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'JINHUA'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/jinhua.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'RUNFAST'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/run.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'PJMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/zn.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'CSMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/cs-majiang.png`" style="width:50px;height:50px;border-radius: 10px;">
            <img class="weui-media-box__thumb" v-else-if="zedata.gameType === 'HUZMAHJONG'" :src="`https://c-c.jiahuagame.com/game_resource/gameicon/${areaCode}/huizhou-majiang.png`" style="width:50px;height:50px;border-radius: 10px;">
          </div>
          <div class="weui-media-box__bd" style="height:60px;">
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-if="zedata.gameType === 'BULLFIGHT'">经典牛牛</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'DIANZINIU'">点子牛牛</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'HONGZHONG'">红中</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'OXFIGHT'">斗公牛</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'SANGONG'">三公</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'HUACHUAN'">划船</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'JINHUA'">欢乐金花</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'RUNFAST'">跑得快</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'PJMAHJONG'">平江扎鸟</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'CSMAHJONG'">长沙麻将</h4>
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;" v-else-if="zedata.gameType === 'HUZMAHJONG'">惠州麻将</h4>

            <!-- <p class="weui-media-box__desc">红中麻将</p> -->
            <h4 class="weui-media-box__title" style="color:#ffb311;font-size:14px;">房间号：{{zedata.roomNo}}</h4>
          </div>
          <div class="jiesan" style="margin-right:12px;">
            <img src="../img/jiesan.png" style="width:50px;height:25px;" @click="jiesan(zedata)">
          </div>
        </a>
              </div>
              <!-- 列表 -->
              <div class="weui-cells" style="margin-top:0;background-color:transparent;height:80%;overflow-y:auto;">
                <div class="weui-cell" style="padding-top:5px;padding-left:10px;padding-bottom: 5px;" v-for="(ren, index) in zedata.players" :key="index + 500">
                  <div class="weui-cell__hd"><img :src="ren.headUrl" style="width:45px;height:45px;border-radius: 5px;"></div>
                    <div class="weui-cell__bd">
                      <p style="color:white;font-size:14px;">{{ren.nickname}}</p>
                    </div>
                    <div class="weui-cell__ft"><img src="../img/remove.png" style="width:50px;height:25px;" @click="yichu(zedata,ren)"></div>
                    </div>
                  </div>
                </div>
                <!-- </div> -->
              </div>
</template>
<script>
import { mapState } from 'Vuex'
import GameConfig from './gameconfig.js'

const GAME_NAME = { 'BULLFIGHT': 1, 'OXFIGHT': 2, 'HONGZHONG': 3, 'DIANZINIU': 4, 'JINHUA': 5, 'SANGONG': 6, 'HUACHUAN': 7, 'RUNFAST': 8, 'CSMAHJONG': 10, 'PJMAHJONG': 11 , 'HUZMAHJONG':13, 'SANJINPK': 15}

export default {
  data() {
    return {
      leftStyle: {},
      shareData: [],
      recordData: [],
      _createTime: '',
      _ruleType: '',
      _bottomType: '',
      _showCardCount: '',
      shareListP: [],
      ShareNickname: '',
      loginU: '',
      tishi: false,
      shareUrl: '',
      shareAppId: '',
      shareLink: '',
      shareNonceStr: '',
      shareSignature: '',
      shareTimestamp: '',
      gameTypeName: '',
      payTypeName: '',
      bottomTypeName: '',
      type: '',
      showCardCountName: '',
      turns: '',
      imgUrlname: '',
      descName: '',
      zhezhaoSty: false,
      zedata: '',
      roomNo: '',
      uid: '',
      currentTableIndex: 0,
      blackZz: false,
      jiesanData: '',
      yichuNo: '',
      yichuUid: '',
      areaCode: ''
    }
  },
  mounted() {
    this.areaCode = Cookies.get('areaCode');
    this.getHeigh()
    this.showRoom()
    this.short()
  },
  activated() {
    // this.xqButtom()
  },
  methods: {
    short(nickname) {
      if (nickname) {
        if (nickname.length > 2) {
          return nickname.slice(0, 5)
        }
      }
      return nickname
    },
    getHeigh() {
      this.leftStyle = {
        height: document.body.offsetHeight + 'px'
      }
    },
    showRoom() {
      const send = {}
      this.api.roomShare.getRoomShow(send).then(res => res.json()).then(data => {
        console.log('showROOM', Object.assign({}, data))
        if (data.result === 0) {
          this.tishi = false;
          this.shareData = data.data.dataList[0].shareList
          console.log('shareData', this.shareData)
          this.recordData = data.data.dataList[0].recordList
          if (this.shareData !== null || this.recordData !== null) {
            if (this.shareData !== null) {
              this.shareData.forEach(item => {
                item._createTime = new Date(item.createTime).toLocaleString()
              })
            }
            if (this.recordData !== null) {
              this.recordData.forEach(item => {
                let roomDescribe = JSON.parse(item.roomDescribe)
                item._createTime = new Date(item.createTime).toLocaleString()
                this.re = roomDescribe
                item._ruleType = this.re.ruleType
                item._bottomType = this.re.bottomType
                item._showCardCount = this.re.showCardCount
                item.maxPlayerCount = roomDescribe.maxPlayerCount
                if (item.maxPlayerCount == 6 && item.totalSettleVo.length > 6) {
                  item.maxPlayerCount = 10
                }
                console.error(item.totalSettleVo)
              })
            }
          } else {
            $.toast('战绩和房间都没有', 'forbidden');
            this.tishi = true;

          }
        } else if (data.result === 2) {
          $.toast(data.message, 'forbidden');
          this.tishi = true;
        } else if (data.result === 600) {
          this.loginU = data.data
          window.location.href = data.data
          return
        }
        this.loginU = data.data.dataList[0].loginUrl
        console.log('url', this.loginU)
      })

    },
    shareButtomAn() {
      $.toast('游戏中,不能分享', 'forbidden');
    },
    shareButtom(item) {
      $.toast('请点击右上角进行分享', 'text');
      console.log('item', item)
      console.log('payType', item.roomConf.payType)
      console.log('room', item.roomNo)
      if (item.gameType === 'OXFIGHT') {
        this.gameTypeName = '公牛'
        this.type = 10001
        this.imgUrlname = 'fight-bull.png'
      } else if (item.gameType === 'HONGZHONG') {
        this.gameTypeName = '红中麻将'
        this.type = 10003
        this.imgUrlname = 'majiang-icon-old.png'
      } else if (item.gameType === 'DIANZINIU') {
        this.gameTypeName = '点子牛牛'
        this.type = 10001
        this.imgUrlname = 'dianzi-bull.png'
      } else if (item.gameType === 'BULLFIGHT') {
        this.gameTypeName = '经典牛牛'
        this.type = 10001
        this.imgUrlname = 'bull-icon-old.png'
      } else if (item.gameType === 'SANGONG') {
        this.gameTypeName = '三公'
        this.type = 10006
        this.imgUrlname = 'sangong.png'
      } else if (item.gameType === 'HUACHUAN') {
        this.gameTypeName = '无庄划船'
        this.type = 10006
        this.imgUrlname = 'jinhua.png'
      } else if (item.gameType === 'JINHUA') {
        this.gameTypeName = '欢乐金花'
        this.type = 10004
        this.imgUrlname = 'jinhua.png'
      } else if (item.gameType === 'RUNFAST') {
        this.gameTypeName = '跑得快'
        this.type = 10008
        this.imgUrlname = 'runfast.png'
      } else if (item.gameType === 'PJMAHJONG') {
        this.gameTypeName = '平江扎鸟'
        this.type = 10011
        this.imgUrlname = 'zn.png'
      } else if (item.gameType === 'CSMAHJONG') {
        this.gameTypeName = '长沙麻将'
        this.type = 10010
        this.imgUrlname = 'cs-majiang.png'
      } else if (item.gameType === 'HUZMAHJONG') {
        this.gameTypeName = '惠州麻将'
        this.type = 10015
        this.imgUrlname = 'huizhou-majiang.png'
      }
      if (item.roomConf.payType === 1) {
        this.payTypeName = 'AA支付'
      } else if (item.roomConf.payType === 2) {
        this.payTypeName = '房主支付'
      }
      // 公牛
      if (item.roomConf.bottomType === 1) {
        this.bottomTypeName = '10分'
      } else if (item.roomConf.bottomType === 2) {
        this.bottomTypeName = '20分'
      } else if (item.roomConf.bottomType === 3) {
        this.bottomTypeName = '30分'
      } else if (item.roomConf.bottomType === 4) {
        this.bottomTypeName = '50分'
      }
      // 红中
      if (item.roomConf.ruleType === 5 && item.gameType === 'HONGZHONG') {
        this.bottomTypeName = '八个码'
      } else if (item.roomConf.ruleType === 1 && item.gameType === 'HONGZHONG') {
        this.bottomTypeName = '一码全中'
      } else if (item.roomConf.ruleType === 2 && item.gameType === 'HONGZHONG') {
        this.bottomTypeName = '两个码'
      } else if (item.roomConf.ruleType === 3 && item.gameType === 'HONGZHONG') {
        this.bottomTypeName = '四个码'
      } else if (item.roomConf.ruleType === 4 && item.gameType === 'HONGZHONG') {
        this.bottomTypeName = '六个码'
      }
      // 牛牛
      if (item.roomConf.ruleType === 1 && item.gameType === 'BULLFIGHT') {
        this.bottomTypeName = '抢庄'
      } else if (item.roomConf.ruleType === 2 && item.gameType === 'BULLFIGHT') {
        this.bottomTypeName = '牛牛庄家'
      } else if (item.roomConf.ruleType === 3 && item.gameType === 'BULLFIGHT') {
        this.bottomTypeName = '牌大坐庄'
      } else if (item.roomConf.ruleType === 4 && item.gameType === 'BULLFIGHT') {
        this.bottomTypeName = '轮庄'
      } else if (item.roomConf.ruleType === 5 && item.gameType === 'BULLFIGHT') {
        this.bottomTypeName = '霸王庄'
      } else if (item.roomConf.ruleType === 6 && item.gameType === 'DIANZINIU') {
        this.bottomTypeName = '牛几几倍'
      } else if (item.roomConf.ruleType === 7 && item.gameType === 'DIANZINIU') {
        this.bottomTypeName = '牛牛相差'
      } else if (item.roomConf.ruleType === 0 && item.gameType === 'HUACHUAN') {
        this.bottomTypeName = '无庄开船'
      } else if (item.roomConf.ruleType === 0 && item.gameType === 'SANGONG') {
        this.bottomTypeName = '无庄开船'
      } else if (item.roomConf.ruleType === 1 && item.gameType === 'SANGONG') {
        this.bottomTypeName = '抢庄'
      } else if (item.roomConf.ruleType === 2 && item.gameType === 'SANGONG') {
        this.bottomTypeName = '三公庄家'
      } else if (item.roomConf.ruleType === 3 && item.gameType === 'SANGONG') {
        this.bottomTypeName = '牌大坐庄'
      } else if (item.roomConf.ruleType === 4 && item.gameType === 'SANGONG') {
        this.bottomTypeName = '轮庄'
      } else if (item.roomConf.ruleType === 5 && item.gameType === 'SANGONG') {
        this.bottomTypeName = '霸王庄'
      } else if (item.roomConf.ruleType === 1 && item.gameType === 'JINHUA') {
        this.bottomTypeName = '十回合封顶'
      } else if (item.roomConf.ruleType === 2 && item.gameType === 'JINHUA') {
        this.bottomTypeName = '二十回合封顶'
      } else if (item.roomConf.ruleType === 3 && item.gameType === 'JINHUA') {
        this.bottomTypeName = '三十回合封顶'
      } else if (item.roomConf.ruleType === 1 && item.gameType === 'RUNFAST') {
        this.bottomTypeName = '十五张'
      } else if (item.roomConf.ruleType === 2 && item.gameType === 'RUNFAST') {
        this.bottomTypeName = '十六张'
      }
      // 扎鸟麻将
      if (item.roomConf.ruleType === 1 && item.gameType === 'PJMAHJONG') {
        this.bottomTypeName = '一个码'
      } else if (item.roomConf.ruleType === 2 && item.gameType === 'PJMAHJONG') {
        this.bottomTypeName = '两个码'
      } else if (item.roomConf.ruleType === 3 && item.gameType === 'PJMAHJONG') {
        this.bottomTypeName = '三个码'
      }


      let str = ''
      let gameId = GAME_NAME[item.gameType];

      Object.keys(item.roomConf).forEach((el) => {
        if (GameConfig[gameId]) {
          let cf = GameConfig[gameId][el]
          if(cf) {
            if ( cf[item.roomConf[el]]) {
              str += `${cf[item.roomConf[el]]} `
            }  
          }
        }
      })

      console.error(str)
      this.bottomTypeName = str;

      // 几张可见
      this.showCardCountName = item.roomConf.showCardCount
      // 总局数
      // this.turns = item.roomConf.turns
      this.turns = item.totalTurns
      // 描
      if (!this.showCardCountName) {
        this.descName = this.payTypeName + ';' + '玩法:' + this.bottomTypeName // 分享描述
      } else {
        this.descName = this.payTypeName + ';' + '玩法:' + this.bottomTypeName + ';' + this.showCardCountName + '张可见' // 分享描述
      }
      // this.type = item.gameType + 10000
      // this.shareshare = true;
      this.shareUrl = Cookies.get('shareUrl')
      const send = {
        shareUrl: this.shareUrl
      }
      this.api.roomShare.getAppId(send).then(res => res.json()).then(data => {
        console.log('appId', data)
        this.shareAppId = data.data.shareAppId
        this.shareLink = data.data.shareLink
        this.shareNonceStr = data.data.shareNonceStr
        this.shareSignature = data.data.shareSignature
        this.shareTimestamp = data.data.shareTimestamp
        wx.config({
          // debug: true,
          debug: false,
          appId: this.shareAppId,
          timestamp: this.shareTimestamp,
          nonceStr: this.shareNonceStr,
          signature: this.shareSignature,
          jsApiList: [
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'hideMenuItems',
            'showMenuItems',
            'hideAllNonBaseMenuItem',
            'showAllNonBaseMenuItem',
            'translateVoice',
            'startRecord',
            'stopRecord',
            'playVoice',
            'pauseVoice',
            'stopVoice',
            'uploadVoice',
            'downloadVoice',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'getNetworkType',
            'openLocation',
            'getLocation',
            'hideOptionMenu',
            'showOptionMenu',
            'closeWindow',
            'scanQRCode',
            'chooseWXPay',
            'openProductSpecificView',
            'addCard',
            'chooseCard',
            'openCard'
          ]
        });
        // 分享到朋友圈
        // wx.onMenuShareTimeline({
        //   title: '', // 分享标题
        //   desc: 'hahaha',
        //   link: this.shareLink, // 分享链接，该链接域名必须与当前企业的可信域名一致
        //   imgUrl: '', // 分享图标
        //   success: function() {
        //     // 用户确认分享后执行的回调函数
        //   },
        //   cancel: function() {
        //     // 用户取消分享后执行的回调函数
        //   }
        // });
        // 分享给朋友
        wx.onMenuShareAppMessage({
          title: this.gameTypeName + '  [' + '房间号:' + item.roomNo + ']  ', // 分享标题
          desc: this.descName,
          link: this.shareLink + '?roomNo=' + item.roomNo + '&type=' + this.type, // 分享链接，该链接域名必须与当前企业的可信域名一致
          imgUrl: 'https://c-c.jiahuagame.com/game_resource/gameicon/' + Cookies.get('areaCode') + '/' + this.imgUrlname, // 分享图标
          type: '', // 分享类型,music、video或link，不填默认为link
          dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
          success: function() {
            // 用户确认分享后执行的回调函数
          },
          cancel: function() {
            // 用户取消分享后执行的回调函数
          }
        });
      })
    },
    xqButtom(item, index) {
      this.currentTableIndex = index
      console.log('111', item)
      this.zhezhaoSty = true;
      this.zedata = item
      // this.blackZz = true
      document.getElementById('rTwo').style.opacity = 0.6
      document.getElementById('Two').style.opacity = 0.6
      // document.getElementById('zhezhao').style.opacity = 1
    },
    jiesan(item) {
      this.jiesanData = item
      console.log('jiesanData', this.jiesanData.roomNo)
      $.confirm('确认解散房间吗？', () => this.jiesanBu(), () => this.showRoom());
    },
    jiesanBu() {
      const send = {
        roomNo: this.jiesanData.roomNo,
      }
      console.log('roomNo', this.jiesanData.roomNo)
      this.api.roomShare.getJiesan(send).then(res => res.json()).then(data => {
        document.getElementById('rTwo').style.opacity = 1
        document.getElementById('Two').style.opacity = 1
        if (data.result === 0) {
          this.zhezhaoSty = false
          // setTimeout(this.showRoom(), 5000)
          $.toast('解散成功')
          setTimeout(() => {
            this.showRoom()
          }, 2000)
        } else {
          $.toast('解散失败', 'forbidden');
        }
        console.log('hh', data)
      })
    },
    yichu(item, item2) {
      this.yichuNo = item
      this.yichuUid = item2
      console.log('jiesanData', this.jiesanData.roomNo)
      $.confirm('确认移除吗？', () => this.yichuBu(), () => this.showRoom());
    },
    yichuBu() {
      const send = {
        roomNo: this.yichuNo.roomNo,
        uid: this.yichuUid.uid,
      }
      var playerIndex = this.yichuNo.players.findIndex(player => player.uid === this.yichuUid.uid)
      // var playerIndex = item.players.findIndex(player => player.uid === item2.uid)
      console.log('roomNo', this.yichuNo.roomNo, playerIndex)
      this.api.roomShare.getYichu(send).then(res => res.json()).then(data => {
        if (data.result === 0) {
          this.yichuNo.players.splice(playerIndex, 1)
          $.toast('移除成功')
          // item.players
          // setTimeout(() => { this.showRoom() }, 10000)
          // setTimeout(() => { this.xqButtom(item) }, 10000)
        } else {
          $.toast('移除失败', 'forbidden');
        }
        console.log('yichu', data)
      })
    },
    qudiao() {
      this.zhezhaoSty = false
      document.getElementById('rTwo').style.opacity = 1
      document.getElementById('Two').style.opacity = 1
    }
  },
  computed: {
    ...mapState(['api', 'VueEventBus'])
  },
  components: {}
}
</script>
<style lang="less">
.rTwo {
  background-image: url('../img/bg.png');
  height: 100%;
  width: 100%;
  background-size: cover;
}

.roomTwo {
  height: 89%;
  width: 92%;
  margin-left: 4%;
  overflow-y: auto;

  .shareTwo {
    margin-top: 10px;
    width: 100%;
    background-clip: content-box;
    background-size: cover;
    background-position: 0% 0%;
    height: 28%;
    position: relative;

    img {
      width: 100%;
      height: 100%;
      position: absolute;
    }

    .weui-cell {
      padding: 0px;
      height: 43%;
      width: 93%;
      margin-left: 3.5%;

      .weui-cell__bd {
        height: 65%;
        width: 40%;

        span {
          color: #ffb311;
          font-size: 14px;
        }

        .time {
          width: 90%;

          p {
            color: white;
            font-size: 13px;
          }
        }
      }

      .weui-cell__hd {
        height: 55%;
        width: 17%;

        img {
          width: 43px;
          height: 43px;
        }
      }

      .weui-cell__ft {
        height: 40%;

        img {
          width: 50px;
          height: 30px;
          position: static;
        }
      }
    }

    .share-two {
      width: 92%;
      margin-left: 4%;
      position: relative;
      height: 39%;

      ul {
        height: 100%;

        li {
          height: 50%;
          width: 32%;
          text-align: center;

          span {
            text-align: center;
            color: white;
            font-size: 14px;
          }
        }
      }
    }

    .share-three {
      height: 17%;
      position: relative;

      p {
        float: left;
        margin-left: 10px;
        font-size: 13px;
        color: white;
      }
    }
  }
}

.share-three:after {
  content: " ";
  display: block;
  clear: both;
  height: 0;
}

.footer:after {
  content: " ";
  display: block;
  clear: both;
  height: 0;
}

footer {
  position: absolute;
  width: 100%;
  bottom: 0;
  background-image: url('../img/back-bottom.png');
  flex: 0 0 auto;
}

.zhezhao {
  position: absolute; // position: relative;
  // z-index: 100;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0; // border: solid 1px red;
  width: 80%;
  margin-left: 10%;
  height: 70%;
  margin-top: 20%;
  z-index: 1;

  img {
    // border: solid 1px red;
    width: 100%;
    height: 100%;
  }
}

.weui-cell:before {
  width: 94%;
  margin-left: 3%;
  left: 0;
}

@media screen and (max-width:340px) {
  .roomTwo {
    height: 89%;
    width: 92%;
    margin-left: 4%;
    overflow-y: auto;

    .shareTwo {
      margin-top: 10px;
      width: 100%;
      background-clip: content-box;
      background-size: cover;
      background-position: 0% 0%;
      height: 28%;
      position: relative;

      img {
        width: 100%;
        height: 100%;
        position: absolute;
      }

      .weui-cell {
        padding: 0px;
        height: 43%;
        width: 93%;
        margin-left: 3.5%;

        .weui-cell__bd {
          height: 65%;
          width: 40%;

          span {
            color: #ffb311;
            font-size: 14px;
          }

          .time {
            width: 90%;

            p {
              color: white;
              font-size: 13px;
            }
          }
        }

        .weui-cell__hd {
          height: 55%;
          width: 17%;

          img {
            width: 43px;
            height: 43px;
          }
        }

        .weui-cell__ft {
          height: 40%;

          img {
            width: 30px;
            height: 25px;
            position: static;
          }
        }
      }

      .share-two {
        width: 92%;
        margin-left: 4%;
        position: relative;
        height: 39%;

        ul {
          height: 100%;

          li {
            height: 50%;
            width: 32%;
            text-align: center;

            span {
              text-align: center;
              color: white;
              font-size: 14px;
            }
          }
        }
      }

      .share-three {
        height: 17%;
        position: relative;

        p {
          float: left;
          margin-left: 10px;
          font-size: 13px;
          color: white;
        }
      }
    }
  }
}

@media screen and (min-width:340px) and (max-width:376px) {
  .roomTwo {
    height: 89%;
    width: 92%;
    margin-left: 4%;
    overflow-y: auto;

    .shareTwo {
      margin-top: 10px;
      width: 100%;
      background-clip: content-box;
      background-size: cover;
      background-position: 0% 0%;
      height: 28%;
      position: relative;

      img {
        width: 100%;
        height: 100%;
        position: absolute;
      }

      .weui-cell {
        padding: 0px;
        height: 43%;
        width: 93%;
        margin-left: 3.5%;

        .weui-cell__bd {
          height: 65%;
          width: 40%;

          span {
            color: #ffb311;
            font-size: 14px;
          }

          .time {
            width: 90%;

            p {
              color: white;
              font-size: 13px;
            }
          }
        }

        .weui-cell__hd {
          height: 55%;
          width: 17%;

          img {
            width: 43px;
            height: 43px;
          }
        }

        .weui-cell__ft {
          height: 40%;

          img {
            width: 40px;
            height: 25px;
            position: static;
          }
        }
      }

      .share-two {
        width: 92%;
        margin-left: 4%;
        position: relative;
        height: 39%;

        ul {
          height: 100%;

          li {
            height: 50%;
            width: 32%;
            text-align: center;

            span {
              text-align: center;
              color: white;
              font-size: 14px;
            }
          }
        }
      }

      .share-three {
        height: 17%;
        position: relative;

        p {
          float: left;
          margin-left: 10px;
          font-size: 13px;
          color: white;
        }
      }
    }
  }
}

.bottom-img-6 {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

.niuniu10 {
  height: 36% !important;

  .weui-cell {
    height: 33% !important;
  }

  .share-two {
    height: 54% !important;

    li {
      height: 24% !important;
    }
  }
}
</style>